#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int fastIndex = 0;
        int slowIndex = 0;
        while (fastIndex != nums.size())
        {
            if (nums[fastIndex] == nums[slowIndex])
            {
                ++fastIndex;
            }
            else
            {
                ++slowIndex;
                nums[slowIndex] = nums[fastIndex];
                ++fastIndex;
            }
        }
        return slowIndex + 1;
    }
};
int main()
{
    vector<int> v = { 1,1,1,2,2,5,5,5,9,11 };
    cout << Solution().removeDuplicates(v) << endl;
    return 0;
}